<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Error extends Model
{
    use HasFactory;

    public $guarded = [];
    const UPDATED_AT = null;

    static function log($msg, $send, $get) {
        if ($send && (is_array($send) || is_object($send))) {
            $send = json_encode($send);
        }

        if ($get && (is_array($get) || is_object($get))) {
            $get = json_encode($get);
        }

        self::create([
            'msg'   => $msg,
            'send'  => $send,
            'get'   => $get
        ]);
    }
}
